// 用户相关类型定义
export interface UserInfo {
  id: number;
  username: string;
  email: string;
  avatar?: string;
  bio?: string;
  tier?: string;
  createdAt: string;
  updatedAt: string;
}

export interface UserAbilities {
  id: number;
  userId: number;
  breakingIce: number;
  empathy: number;
  conversationFlow: number;
  isBaseline: boolean;
  createdAt: string;
}

export interface UserAchievement {
  id: number;
  userId: number;
  achievementKey: string;
  achievementName: string;
  description: string;
  unlockedAt: string;
}

export interface UserStatistics {
  id: number;
  userId: number;
  totalTrainingSessions: number;
  successfulSessions: number;
  consecutiveDays: number;
  lastTrainingDate: string;
  totalExperiencePoints: number;
}

export interface UserTier {
  id: number;
  name: string;
  displayName: string;
  level: number;
  minPoints: number;
  maxPoints: number;
  currentPoints: number;
  nextTierPoints: number;
  color: string;
  icon: string;
  benefits: string[];
  badgeUrl: string;
}

export interface LoginCredentials {
  email: string;
  password: string;
  rememberMe?: boolean;
}

export interface RegisterData {
  username: string;
  email: string;
  password: string;
  password_confirmation: string;
  agreeToTerms: boolean;
}

export interface UpdateProfileData {
  username?: string;
  email?: string;
  avatar?: string;
}

export interface ResetPasswordData {
  token: string;
  email: string;
  password: string;
  password_confirmation: string;
}

export interface User {
  id: number;
  username: string;
  email: string;
  avatar?: string;
  bio?: string;
  location?: string;
  website?: string;
  socialLinks?: {
    twitter?: string;
    linkedin?: string;
    github?: string;
  };
  tier: string;
  level: number;
  experiencePoints: number;
  isEmailVerified: boolean;
  isActive: boolean;
  lastLoginAt?: string;
  createdAt: string;
  updatedAt: string;
}

export interface UserProfile extends User {
  stats: UserStats;
  abilities: UserAbilities;
  preferences: UserPreferences;
}

export interface UserStats {
  totalTrainingSessions: number;
  totalTrainingTime: number; // 分钟
  averageSessionDuration: number; // 分钟
  successRate: number; // 百分比
  favoriteCharacters: number[];
  favoriteScenarios: number[];
  skillsImproved: string[];
  currentStreak: number; // 连续训练天数
  longestStreak: number;
  totalPointsEarned: number;
  currentTier: string;
  nextTierProgress: number; // 百分比
}

export interface ChangePasswordData {
  currentPassword: string;
  newPassword: string;
  confirmPassword: string;
}

export interface UserPreferences {
  language: "zh-CN" | "en-US";
  theme: "light" | "dark" | "auto";
  notifications: {
    push: boolean;
    email: boolean;
    sms: boolean;
    achievement: boolean;
    challenge: boolean;
    social: boolean;
    training: boolean;
  };
  privacy: {
    profileVisible: boolean;
    trainingHistoryVisible: boolean;
    achievementsVisible: boolean;
    allowFriendRequests: boolean;
  };
  training: {
    defaultDifficulty: "beginner" | "intermediate" | "advanced";
    voiceEnabled: boolean;
    hintsEnabled: boolean;
    autoSave: boolean;
  };
  accessibility: {
    fontSize: "small" | "medium" | "large";
    highContrast: boolean;
    reduceMotion: boolean;
    screenReader: boolean;
  };
}

// 排行榜用户类型（扩展基础用户类型）
export interface LeaderboardUser extends User {
  score: number; // 用户分数
  rank?: number; // 排名
  rank_change?: number; // 排名变化
  is_online?: boolean; // 是否在线
  is_current_user?: boolean; // 是否是当前用户
  is_vip?: boolean; // 是否VIP用户
  is_verified?: boolean; // 是否认证用户
}
